package com.hoshiicloud.user.controller.login;


import com.hoshiicloud.common.constant.UserTypeEnum;
import com.hoshiicloud.common.rpc.Response;
import com.hoshiicloud.user.feign.AuthService;
import com.hoshiicloud.auth.param.HoshiiLoginParam;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 *  @description: 登录控制器
 *  @create: 2019-07-02 10:03
 */
@Api(tags = "登录接口")
@RestController
public class SaasLoginController {
    @Autowired
    private AuthService authService;

    @ApiOperation(value = "saas系统用户登录")
    @PostMapping(value = "/saas/login")
    public Response saasUserLogin(@RequestBody  @Valid HoshiiLoginParam param){
        return authService.login(param.getPhone(),param.getPassword(), UserTypeEnum.SAAS.getUserType(),"1");
    }

    @ApiOperation(value = "用户注销")
    @PostMapping(value = "/saas/logout")
    public Response saasLogout(){
        return authService.logout();
    }





}
